<template>
  <div class="index-page">
    <swiper/>
    <div class="logout-button">
      <el-button @click="logout" type="danger" plain>退出登录</el-button>
    </div>
  </div>
</template>

<script setup>
import {get} from  "@/api/request.js"
import {ElMessage} from "element-plus";
import router from "@/router/index.js";
import {useCounterStore} from "@/stores/counter.js";
import Swiper from "@/components/index/swiper.vue";

const store = useCounterStore();
const logout = () => {
  get('api/auth/logout', (message) => {
    ElMessage.success(message)
    store.auth.user = null
    router.push('/')
  })
}
</script>

<style scoped>
  @import "@/assets/css/index.scss";
</style>